//
// Created by lqk on 2022/2/21.
//

#ifndef QUADCEREBELLUM_OFFSETDURATIONGAIT_H
#define QUADCEREBELLUM_OFFSETDURATIONGAIT_H
#include "Eigen/Eigen"
#include "iostream"

class OffsetDurationGait {
public:
    OffsetDurationGait(int nSegment, Eigen::Vector4i offsets, int stance, const std::string& name);
    Eigen::Vector4f GetStancePhase();
    Eigen::Vector4f GetSwingPhase();
    int* GetMPCTable();
    float GetStanceDuration(float dtMPC);
    float GetSwingDuration(float dtMPC);
    float GetGaitPhase();
    void UpdatePhase(int loopsPerMPC,int loopsCounter);
    ~OffsetDurationGait();
private:
    int* m_mpcTable;
    Eigen::Array4i m_offsets;// Offsets of each leg in MPC segments
    Eigen::Array4f m_offsetsFloat;// Offsets in phase (0 to 1) of Gait Period
    int m_stance;// Duration of stance in MPC segments
    float m_stanceFloat;// Stance in phase (0 to 1) of Gait Period
    int m_mpcIteration;
    int m_nSegment;
    float m_phase;// Phase of Gait Period
    std::string m_name;
};


#endif //QUADCEREBELLUM_OFFSETDURATIONGAIT_H
